//
//  USTodayMomentCell.m
//  us
//
//  Created by karry on 2025/6/23.
//

#import "USTodayMomentCell.h"

@implementation USTodayMomentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.leftTipView.layer.cornerRadius = 2;
    self.leftTipView.layer.masksToBounds = YES;
    
    self.imgView.layer.cornerRadius = 4;
    self.imgView.contentMode = UIViewContentModeScaleAspectFill;
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


- (void)setMomentsModel:(USMomentsModel *)momentsModel {
    _momentsModel = momentsModel;
    
    
    NSString *name = @"";
    if ([momentsModel.moodDiaryDto.userId isEqualToString: USUser.user.userId]) {
        self.leftTipView.backgroundColor = [UIColor jk_colorWithHex:0xFF967C];
        self.nameLab.text = @"我的";
        name = USUser.user.nickname;
    }else{
        self.leftTipView.backgroundColor = UIColor.us_blueColor;
        self.nameLab.text = [NSString stringWithFormat:@"%@的",USUser.user.relUser.nickname];
        name = USUser.user.relUser.nickname;
    }
    
    self.contentLab.text = momentsModel.moodDiaryDto.diaryContent;
    
    if (momentsModel.moodDiaryDto.diaryContent.length == 0 && momentsModel.photoList.count > 0) {
        self.imgView.hidden = NO;
        [self.imgView sd_setImageWithURL:[NSURL URLWithString:momentsModel.photoList.firstObject.cosUrl.photoThumbnail]];
        self.contentLab.text = [NSString stringWithFormat:@"%@上传了%li张图片",name,momentsModel.photoList.count];
        
    }else{
        self.imgView.hidden = YES;
        
    }
}

@end
